import { setStore, getStore } from '@/util/store'
// 统一权限管理

const pmae = {
  state: {
    applicationId: getStore({ name: 'applicationId' }) || '',
    applicationName: getStore({ name: 'applicationName' }) || ''
  },
  actions: {
    SetApplication({ commit }, applicationObj) {
      commit('SET_APPLICATION', applicationObj)
    }
  },
  mutations: {
    // 改变权限id
    SET_APPLICATION(state, obj) {
      state.applicationId = obj.applicationId
      state.applicationName = obj.applicationName
      setStore({ name: 'applicationId', content: obj.applicationId, type: 'session' })
      setStore({ name: 'applicationName', content: obj.applicationName, type: 'session' })
    }
  }

}
export default pmae
